package com.ITOT;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import androidhive.dashboard.R;

public class AndroidDashboardDesignActivity extends Activity {
    int windowwidth;
    int windowheight;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dashboard_layout);
        
        windowwidth = getWindowManager().getDefaultDisplay().getWidth();
        windowheight = getWindowManager().getDefaultDisplay().getHeight();
        /**
         * Creating all buttons instances
         * */

        Button btn_audio = (Button) findViewById(R.id.btn_audio);
        

      
        
        Button btn_games = (Button) findViewById(R.id.btn_game);
        
        Button btn_math = (Button) findViewById(R.id.btn_math);
        
           

        final Button btn_picture = (Button) findViewById(R.id.btn_picture);
        

        Button btn_sketch = (Button) findViewById(R.id.btn_sketch);
        
        

        Button btn_video = (Button) findViewById(R.id.btn_video);
        
        /**
         * Handling all button click events
         * */
        /*btn_picture.setOnTouchListener(new View.OnTouchListener() {
			
			@Override
			public boolean onTouch(View v, MotionEvent event) {
				// TODO Auto-generated method stub
				LinearLayout.LayoutParams layoutparams = (LinearLayout.LayoutParams) btn_picture.getLayoutParams();
				switch(event.getAction()){
				case MotionEvent.ACTION_DOWN:break;
				case MotionEvent.ACTION_MOVE:
					int x = (int)event.getRawX();
					int y = (int)event.getRawY();
					if(x>windowwidth){x=windowwidth;}
                    if(y>windowheight){y=windowheight;}

                    layoutparams.gravity = x -25;
                    layoutparams.gravity = y - 75;

                    btn_picture.setLayoutParams(layoutparams);
                    break;
default:
                    break;
				}
				return false;
			}
		});*/
        // Listening to audio button click
        btn_audio.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View view) {
				// Launching News Feed Screen
				Intent i = new Intent(getApplicationContext(), AudioActivity.class);
				startActivity(i);
			}
		});
        
       // Listening book button click
      
        
        // Listening flash button click
       
        // Listening to game button click
        btn_games.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View view) {
				// Launching News Feed Screen
				Intent i = new Intent(getApplicationContext(), GameActivity.class);
				startActivity(i);
			}
		});
        

        btn_math.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View view) {
				// Launching News Feed Screen
				Intent i = new Intent(getApplicationContext(), MathActivity.class);
				startActivity(i);
			}
		});
        
        // Listening to notes button click
        
        
        btn_picture.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View view) {
				// Launching News Feed Screen
				System.out.print("Blh blah blha0");
				Log.d("clicked" , "picture");
				Intent i = new Intent(getApplicationContext(), PictureActivity.class);
				startActivity(i);
			}
		});

        btn_sketch.setOnClickListener(new View.OnClickListener() {
	
        	@Override
        	public void onClick(View view) {
			// Launching News Feed Screen
        		Log.d("clicked" , "sketch");
        		Intent i = new Intent(getApplicationContext(), SketchActivity.class);
				startActivity(i);
        	}
        });

       

        btn_video.setOnClickListener(new View.OnClickListener() {
	
	@Override
	public void onClick(View view) {
		// Launching News Feed Screen
		Intent i = new Intent(getApplicationContext(), PlayVideoResFolder.class);
		startActivity(i);
	}
});
    }
}